package com.jiangnan.utils;

import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author chenliang
 * @email wschenliang@aliyun.com
 */
public class MapUtils {


    public static boolean isNotEmpty(Map<String, String> properties) {
        return properties != null && properties.keySet().size() >= 1;
    }

    public static boolean isEmpty(Map<Class<?>, Map<Type, Type>> typeMap) {
        return typeMap == null || typeMap.keySet().size() == 0;
    }

    public static String toString(HashMap<String, Object> map, String gap) {
        if (map == null || map.size() == 0) {
            return null;
        }
        StringBuilder sb = new StringBuilder();
        for (String key : map.keySet()) {
            sb.append(key).append(gap).append(map.get(key)).append("\n");
        }
        return sb.toString();
    }
}
